<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>unexpand</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_001_014_2524">&nbsp;</a>NAME</h4><blockquote>
unexpand - convert spaces to tabs
</blockquote><h4><a name = "tag_001_014_2525">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

unexpand <b>[</b> -a| -t <i>tablist</i><b>][</b><i>file</i>...<b>]</b>
</code>
</pre>
</blockquote><h4><a name = "tag_001_014_2526">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>unexpand</i>
utility
copies files or standard input to standard output,
converting
blank characters
at the beginning of each line into the maximum number of
tab characters
followed by the minimum number of
space characters
needed to fill the same
column positions originally filled by the translated
blank characters.
By default, tabstops are set at every eighth column position.
Each
backspace
character is copied to the output, and causes the
column position count for tab calculations to be decremented;
the count will
never be decremented to a value less than one.
</blockquote><h4><a name = "tag_001_014_2527">&nbsp;</a>OPTIONS</h4><blockquote>
The
<i>unexpand</i>
utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> .
<p>
The following option is supported:
<dl compact>

<dt><b>-a</b>
<dd>In addition to translating
blank characters
at the beginning of each line, translate
all sequences of two or more
blank characters
immediately preceding a tab stop to the
maximum number of
tab characters
followed by the minimum number of
space characters
needed to
fill the same column positions originally
filled by the translated
blank characters.

<dt><b>-t&nbsp;</b><i>tablist</i>
<dd>
Specify the tab stops.
The option-argument
<i>tablist</i>
must be a single argument
consisting of a single positive decimal integer or multiple
positive decimal integers,
separated by
blank characters
or commas, in ascending order.
If a single number is given, tabs will be set
<i>tablist</i>
column positions apart instead of the default 8.
If multiple numbers are given,
the tabs will be set at those
specific column positions.

Each tab-stop position
<i>N</i>
must be an integer value greater than zero,
and the list must be in strictly ascending order.
This is taken to mean that, from the start of a line of
output, tabbing to position
<i>N</i>
will cause the next character output to
be in the
(<i>N</i>+1)th
column position on that line.
When the
<b>-t</b>
option is not specified,
the default is the equivalent of specifying
<b>-t 8</b>
(except for the interaction with
<b>-a</b>,
described below).

No
space-to-tab character
conversions occur for characters at positions
beyond the last of those specified in a multiple tab-stop list.

When
<b>-t</b>
is specified, the presence or absence of the
<b>-a</b>
option is ignored;
conversion will not be limited to the processing of leading
blank characters.

</dl>
</blockquote><h4><a name = "tag_001_014_2528">&nbsp;</a>OPERANDS</h4><blockquote>
The following operand is supported:
<dl compact>

<dt><i>file</i><dd>A pathname of a text file to be used as input.

</dl>
</blockquote><h4><a name = "tag_001_014_2529">&nbsp;</a>STDIN</h4><blockquote>
See the INPUT FILES section.
</blockquote><h4><a name = "tag_001_014_2530">&nbsp;</a>INPUT FILES</h4><blockquote>
The input files must be text files.
<br>
</blockquote><h4><a name = "tag_001_014_2531">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>
The following environment variables affect the execution of
<i>unexpand</i>:
<dl compact>

<dt><i>LANG</i><dd>Provide a default value for the internationalisation variables
that are unset or null.
If
<i>LANG</i>
is unset or null, the corresponding value from the
implementation-dependent default locale will be used.
If any of the internationalisation variables contains an invalid setting, the
utility will behave as if none of the variables had been defined.

<dt><i>LC_ALL</i><dd>
If set to a non-empty string value,
override the values of all the other internationalisation variables.

<dt><i>LC_CTYPE</i><dd>
Determine the
locale for the interpretation of sequences of bytes of text data as
characters (for example, single- as opposed to multi-byte characters
in arguments and input files),
the processing of
tab
and
space characters
and for the determination of the width in column positions
each character would occupy on a constant-width-font output device.

<dt><i>LC_MESSAGES</i><dd>
Determine the locale that should be used to affect
the format and contents of diagnostic
messages written to standard error.

<dt><i>NLSPATH</i><dd>
Determine the location of message catalogues
for the processing of
<i>LC_MESSAGES .
</i>
</dl>
</blockquote><h4><a name = "tag_001_014_2532">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_2533">&nbsp;</a>STDOUT</h4><blockquote>
The standard output is equivalent to the input files with
the specified
space
to
tab character
conversions.
</blockquote><h4><a name = "tag_001_014_2534">&nbsp;</a>STDERR</h4><blockquote>
Used only for diagnostic messages.
</blockquote><h4><a name = "tag_001_014_2535">&nbsp;</a>OUTPUT FILES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2536">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2537">&nbsp;</a>EXIT STATUS</h4><blockquote>
The following exit values are returned:
<dl compact>

<dt>0<dd>Successful completion.

<dt>&gt;0<dd>An error occurred.

</dl>
</blockquote><h4><a name = "tag_001_014_2538">&nbsp;</a>CONSEQUENCES OF ERRORS</h4><blockquote>
Default.
</blockquote><h4><a name = "tag_001_014_2539">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
One non-intuitive aspect of
<i>unexpand</i>
is its restriction to leading spaces
when neither
<b>-a</b>
nor
<b>-t</b>
is specified.
Users who desire to always convert all spaces in a file
can easily alias
<i>unexpand</i>
to use the
<b>-a</b>
or
<b>-t 8</b>
option.
</blockquote><h4><a name = "tag_001_014_2540">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2541">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_001_014_2542">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="expand.html">expand</a></i>,
<i><a href="tabs.html">tabs</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
